<?php

namespace App\Admin\Actions\Grid\RowActions;

use App\Models\UsersAuth;
use Dcat\Admin\Widgets\Table;
use Dcat\Admin\Admin;
use Dcat\Admin\Widgets\Modal;
use Dcat\Admin\Grid\RowAction;
use Illuminate\Support\Arr;

class CheckReviewStatus extends RowAction
{
    protected $title = '审核意见';

    public function render()
    {
        // 实例化表单类并传递自定义参数
        // $form = AppSendDetailMessage::make()->payload(['id' => $this->getKey()]);

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($this->table(['id' => $this->getKey()]))
            ->button($this->title);
    }

    protected function table($input)
    {
        $userAuth = UsersAuth::where('user_id', $input['id'])->first();
        Admin::style('.table td{padding: .85rem .55rem}');
        $data = [
            ['name' => '审核意见',       'value' => $userAuth->reason],
            ['name' => '审核时间',       'value' => $userAuth->examine_time],

        ];
        return Table::make([], $data);
    }
}
